#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
	int i,n,target,length,nums_size;
	scanf("%d",&n);
	scanf("%d",&target);
	int nums[n];
	while(n--)
	{
		scanf("%d",nums[i]);
	}
	nums_size= sizeof(nums);
	length = sizeof(nums);
	int j,sum = 0;
	for(i = 0;i < nums_size;i++)
	{
		sum +=nums[i];
		while(sum >= target)
		{
			length = fmin(length,i - j + 1);
			sum -= nums[j++];
		}
	}
	if (length == sizeof(nums))
	{
		length == 0;
	}
	printf("%d",length);
	return 0;
}
